import Vue from 'vue'
import Router from 'vue-router'
import Layout from '../layout/index'

Vue.use(Router)

export const constantRouterMap = [
  {
    path: '/login',
    meta: { title: '登录', noCache: true },
    component: (resolve) => require(['@/views/login'], resolve),
    hidden: true
  },
  {
    path: '/register',
    meta: { title: '注册', noCache: true },
    component: (resolve) => require(['@/views/register'], resolve),
    hidden: true
  },
  {
    path: '/404',
    component: (resolve) => require(['@/views/features/404'], resolve),
    hidden: true
  },
  {
    path: '/401',
    component: (resolve) => require(['@/views/features/401'], resolve),
    hidden: true
  },
  {
    path: '/redirect',
    component: Layout,
    hidden: true,
    children: [
      {
        path: '/redirect/:path*',
        component: (resolve) => require(['@/views/features/redirect'], resolve)
      }
    ]
  },
  {
    path: '/',
    component:  (resolve) => require(['@/views/redirect'], resolve),
    meta: { title: '首页', noCache: true },
    hidden: true,
  },
  // {
  //   path: '/',
  //   component: Layout,
  //   redirect: '/dashboard',
  //   children: [
  //     {
  //       path: 'dashboard',
  //       component: (resolve) => require(['@/views/home1.vue'], resolve),
  //       name: 'Dashboard',
  //       meta: { title: '首页', icon: 'index', affix: true, noCache: true }
  //     }
  //   ]
  // },
  {
    path: '/approval',
    component: Layout,
    name: 'approval',
    redirect: '/approval/approvalcount',
    hidden:true,
    meta: { title: '成果报批', icon: 'index', affix: true, noCache: true },
    children: [
      {
        path: 'approvalcount',
        component: (resolve) => require(['@/views/unitIndex/approval/index.vue'], resolve),
        name: 'approvalcount',
        meta: { title: '报批主页', icon: 'index', affix: true, noCache: true }
      },
    ]
  },
  {
    path: '/stage',
    component: Layout,
    name: 'stage',
    redirect: '/stageCount',
    hidden:true,
    meta: { title: '阶段进度汇总', icon: 'index', affix: true, noCache: true },
    children: [
      {
        path: 'stageCount',
        component: (resolve) => require(['@/views/unitIndex/stage/stageCount'], resolve),
        name: 'stageCount',
        meta: { title: '汇总', icon: 'index', affix: true, noCache: true }
      },
    ]
  },
  {
    path: '/allnoisy',
    component: Layout,
    name: 'allnoisy',
    redirect: '/allnoisy/allnoisypage',
    hidden:true,
    meta: { title: '所有通知', icon: 'index', affix: true, noCache: true },
    children: [
      {
        path: 'allnoisypage',
        component: (resolve) => require(['@/views/areaIndex/allnoisypage'], resolve),
        name: 'allnoisypage',
        meta: { title: '所有通知界面', icon: 'index', affix: true, noCache: true }
      },
    ]
  },
  {
    path: '/message',
    component: Layout,
    name: 'message',
    redirect: '/message/messagebox',
    hidden:true,
    meta: { title: '通知详情', icon: 'index', affix: true, noCache: true },
    children: [
      {
        path: 'messagebox',
        component: (resolve) => require(['@/views/areaIndex/messagebox'], resolve),
        name: 'messagebox',
        meta: { title: '通知详情', icon: 'index', affix: true, noCache: true }
      },
    ]
  },
  {
    path: '/edit',
    component: Layout,
    name: 'edit',
    redirect: '/edit/editmessage',
    hidden:true,
    meta: { title: '通知详情', icon: 'index', affix: true, noCache: true },
    children: [
      {
        path: 'editmessage',
        component: (resolve) => require(['@/views/areaIndex/noisy/editlist'], resolve),
        name: 'editmessage',
        meta: { title: '通知详情', icon: 'index', affix: true, noCache: true }
      },
    ]
  },
  // {
  //   path: '/apply',
  //   component: Layout,
  //   redirect: '/underApply',
  //   meta: { title: '数据使用申请', icon: 'index', affix: true, noCache: true },
  //   children: [
  //     {
  //       path: 'underApply',
  //       component: (resolve) => require(['@/views/unitIndex/apply/underApply'], resolve),
  //       name: 'underApply',
  //       meta: { title: '未办箱', icon: 'index', affix: true, noCache: true }
  //     },
  //     {
  //       path: 'overApply',
  //       component: (resolve) => require(['@/views/unitIndex/apply/overApply'], resolve),
  //       name: 'overApply',
  //       meta: { title: '已办箱', icon: 'index', affix: true, noCache: true }
  //     },
      
  //   ]
  // },
  // {
  //   path: '/Empower',
  //   component: Layout,
  //   redirect: '/underEmpower',
  //   meta: { title: '数据使用授权', icon: 'index', affix: true, noCache: true },
  //   children: [
  //     {
  //       path: 'underEmpower',
  //       component: (resolve) => require(['@/views/areaIndex/empower/underEmpower'], resolve),
  //       name: 'underEmpower',
  //       meta: { title: '未办箱', icon: 'index', affix: true, noCache: true }
  //     },
  //     {
  //       path: 'overEmpower',
  //       component: (resolve) => require(['@/views/areaIndex/empower/overEmpower'], resolve),
  //       name: 'overEmpower',
  //       meta: { title: '已办箱', icon: 'index', affix: true, noCache: true }
  //     },
      
  //   ]
  // },
 
  // {
  //   path: '/rateRegister',
  //   component: Layout,
  //   redirect: '/overBox',
  //   meta: { title: '进度登记', icon: 'index', affix: true, noCache: true },
  //   children: [
  //     // {
  //     //   path: 'underway',
  //     //   component: (resolve) => require(['@/views/unitIndex/rateRegister/underWay'], resolve),
  //     //   name: 'underway',
  //     //   meta: { title: '在办箱', icon: 'index', affix: true, noCache: true }
  //     // },
  //     {
  //       path: 'overBox',
  //       component: (resolve) => require(['@/views/unitIndex/rateRegister/overBox'], resolve),
  //       name: 'overBox',
  //       meta: { title: '进度箱', icon: 'index', affix: true, noCache: true }
  //     },
  //     {
  //       path: 'warnBox',
  //       component: (resolve) => require(['@/views/unitIndex/rateRegister/warnBox'], resolve),
  //       name: 'warnBox',
  //       meta: { title: '预警箱', icon: 'index', affix: true, noCache: true }
  //     }
  //   ]
  // },
  // {
  //   path: '/result',
  //   component: Layout,
  //   redirect: '/underwayReport',
  //   alwaysShow:true,
  //   meta: { title: '指标成果上报', icon: 'index', affix: true, noCache: true },
  //   children: [
  //     {
  //       path: 'underwayReport',
  //       component: (resolve) => require(['@/views/unitIndex/reportResult/underwayReport'], resolve),
  //       name: 'underwayReport',
  //       meta: { title: '待上报箱', icon: 'index', affix: true, noCache: true }
  //     }
  //   ]
  // },
  // {
  //   path: '/verify',
  //   component: Layout,
  //   redirect: '/underVerify',
  //   meta: { title: '单位审核', icon: 'index', affix: true, noCache: true },
  //   children: [
  //     {
  //       path: 'underVerify',
  //       component: (resolve) => require(['@/views/areaIndex/verify/underVerify'], resolve),
  //       name: 'underVerify',
  //       meta: { title: '待办箱', icon: 'index', affix: true, noCache: true }
  //     }, 
  //     {
  //       path: 'overVerify',
  //       component: (resolve) => require(['@/views/areaIndex/verify/overVerify'], resolve),
  //       name: 'overVerify',
  //       meta: { title: '已办箱', icon: 'index', affix: true, noCache: true }
  //     },
      
  //   ]
  // },
  // {
  //   path: '/classify',
  //   component: Layout,
  //   redirect: '/classifyto',
  //   meta: { title: '规划编制分类管理', icon: 'index', affix: true, noCache: true },
  //   alwaysShow:true,
  //   children: [
  //     {
  //       path: 'classifyto',
  //       component: (resolve) => require(['@/views/areaIndex/classify/index'], resolve),
  //       name: 'classifyto',
  //       meta: { title: '分类填报', icon: 'index', affix: true, noCache: true }
  //     },
  //   ]
  // },
  // {
  //   path: '/count',
  //   component: Layout,
  //   redirect: '/message',
  //   meta: { title: '统计查询', icon: 'index', affix: true, noCache: true },
  //   children: [
  //     {
  //       path: 'message',
  //       component: (resolve) => require(['@/views/areaIndex/count/message'], resolve),
  //       name: 'message',
  //       meta: { title: '规划编制单位信息', icon: 'index', affix: true, noCache: true }
  //     },
  //     {
  //       path: 'situation',
  //       component: (resolve) => require(['@/views/areaIndex/count/situation'], resolve),
  //       name: 'situation',
  //       meta: { title: '底图底数领取情况', icon: 'index', affix: true, noCache: true }
  //     },
  //     {
  //       path: 'progress',
  //       component: (resolve) => require(['@/views/areaIndex/count/progress'], resolve),
  //       name: 'progress',
  //       meta: { title: '辖区规划编制进度', icon: 'index', affix: true, noCache: true }
  //     },
  //   ]
  // },
  // {
  //   path: '/report',
  //   component: Layout,
  //   redirect: '/underwayReport',
  //   meta: { title: '规划编制分类管理', icon: 'index', affix: true, noCache: true },
  //   children: [
  //     {
  //       path: 'underwayReport',
  //       // component: (resolve) => require(['@/views/unitIndex/reportResult/underwayReport'], resolve),
  //       name: 'underwayReport',
  //       meta: { title: '分类填报', icon: 'index', affix: true, noCache: true }
  //     },
  //   ]
  // },
  // {
  //   path: '/report',
  //   component: Layout,
  //   redirect: '/underwayReport',
  //   meta: { title: '统计查询', icon: 'index', affix: true, noCache: true },
  //   children: [
  //     {
  //       path: 'underwayReport',
  //       // component: (resolve) => require(['@/views/unitIndex/reportResult/underwayReport'], resolve),
  //       name: 'underwayReport',
  //       meta: { title: '规划编制单位信息', icon: 'index', affix: true, noCache: true }
  //     },
  //     {
  //       path: 'underwayReport',
  //       // component: (resolve) => require(['@/views/unitIndex/reportResult/underwayReport'], resolve),
  //       name: 'underwayReport',
  //       meta: { title: '底图底数领取情况', icon: 'index', affix: true, noCache: true }
  //     },
  //     {
  //       path: 'underwayReport',
  //       // component: (resolve) => require(['@/views/unitIndex/reportResult/underwayReport'], resolve),
  //       name: 'underwayReport',
  //       meta: { title: '辖区规划编制进度', icon: 'index', affix: true, noCache: true }
  //     },
  //   ]
  // },
  {
    path: '/user',
    component: Layout,
    hidden: true,
    redirect: 'noredirect',
    children: [
      {
        path: 'center',
        component: (resolve) => require(['@/views/system/user/center'], resolve),
        name: '个人中心',
        meta: { title: '个人中心' }
      }
    ]
  }
]

export default new Router({
  // mode: 'hash',
  mode: 'history',
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
})
